<template>
  <div>
    <div class="top-div-left-title">
      <span style="cursor: pointer" @click="toIndex">全流程智能化审判监督平台后台管理系统</span>
    </div>
    <div class="top-div-right-img">
      <img src="@/assets/logout.png" @click="backMenu">
    </div>
    <div class="top-div-right-title">
        <span style="margin-right: 20px;"></span>
        <span></span>
    </div>
  </div>
</template>
<script>

export default {
  data() {
    return {
      now: new Date(),
      timer: null,
    }
  },
  computed: {
    currentPath() {
      return this.$route.path.replaceAll("/",""); // 获取当前路由的path
    },
    formattedDateTime() {
      const {now} = this;
      const year = now.getFullYear();
      const month = ('0' + (now.getMonth() + 1)).slice(-2);
      const day = ('0' + now.getDate()).slice(-2);
      const hours = ('0' + now.getHours()).slice(-2);
      const minutes = ('0' + now.getMinutes()).slice(-2);
      const seconds = ('0' + now.getSeconds()).slice(-2);

      return `${year}年${month}月${day}日 ${hours}时${minutes}分${seconds}秒`;
    }
  },
  mounted() {
    this.timer = setInterval(() => {
      this.now = new Date();
    }, 1000);
  },
  methods: {
    toIndex(){
      this.$router.push({ path: '/' });
    },
    backMenu(){
      if (this.currentPath!='menu'){
        this.$router.push({ path: '/' });
      }
    }
  }
};
</script>
<style scoped>
.top-div-left-title {
  float: left;
  width: 700px;
  margin-left: 10px;
}

.top-div-left-title span {
  font-size: 22px;
  color: #ffffff;
  font-weight: 500;
}



.top-div-right-title span {
  font-size: 23px;
  color: #ffffff;
  font-weight: 500;
}

.top-div-right-img{
  float: right;
  margin-right: 10px;
}

img{
  height: 36px;
  width: 36px;
  cursor: pointer;
}
</style>